]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
unlockDialog: Add .critical CSS class to critical notifications
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 5 Feb 2020 14:58:57 +0000 (11:58 -0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 10 Feb 2020 22:30:52 +0000 (22:30 +0000)
As per the latest lock screen mockups, critical notifications must have
a more prominent, solid color.

Add a .critical style class to critical notification bubbles, and make
them darker.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872

data/theme/gnome-shell-sass/widgets/_screen-shield.scss
js/ui/unlockDialog.js

index a28ef273843d19b46aab188d79dbd3e74a2a9ffe..2c45589aca0f25e55e59a3deaf0bcccbf316dbb1 100644 (file)
@@ -35,6 +35,8 @@
     background-color: transparentize($osd_bg_color,0.5);
     color: $osd_fg_color;
     border-radius: 4px;
+
+    &.critical { background-color: transparentize($osd_bg_color,0.1) }
   }
 }
 
index df2126ee8e8bb8d6faf1f1a7f4ba6c714f4381d9..ec08acd1cf1b49249f7d657d2a2147a77a6f1169 100644 (file)
@@ -145,6 +145,20 @@ var NotificationsBox = GObject.registerClass({
                source.narrowestPrivacyScope === MessageTray.PrivacyScope.SYSTEM;
     }
 
+    _updateSourceBoxStyle(source, obj, box) {
+        let hasCriticalNotification =
+            source.notifications.some(n => n.urgency === MessageTray.Urgency.CRITICAL);
+
+        if (hasCriticalNotification !== obj.hasCriticalNotification) {
+            obj.hasCriticalNotification = hasCriticalNotification;
+
+            if (hasCriticalNotification)
+                box.add_style_class_name('critical');
+            else
+                box.remove_style_class_name('critical');
+        }
+    }
+
     _showSource(source, obj, box) {
         if (obj.detailed)
             [obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
@@ -152,6 +166,8 @@ var NotificationsBox = GObject.registerClass({
             [obj.titleLabel, obj.countLabel] = this._makeNotificationSource(source, box);
 
         box.visible = obj.visible && (source.unseenCount > 0);
+
+        this._updateSourceBoxStyle(source, obj, box);
     }
 
     _sourceAdded(tray, source, initial) {
@@ -165,6 +181,7 @@ var NotificationsBox = GObject.registerClass({
             sourceBox: null,
             titleLabel: null,
             countLabel: null,
+            hasCriticalNotification: false,
         };
 
         obj.sourceBox = new St.BoxLayout({